package com.winning.devops.batch.reader.ch05;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author chensj
 * @date 2020-03-02 11:38
 */
@Component("commonJsonItemWriter")
public class CommonJsonItemWriter<T> implements ItemWriter<T> {
    /** logger */
    private static final Logger logger = LoggerFactory.getLogger(CommonJsonItemWriter.class);

    @Override
    public void write(List<? extends T> list) throws Exception {
        if (list.size() > 0) {
            for (T c : list) {
                logger.info("T {}", c);
            }
        }
    }
}
